package com.zengqingfa.juc.n4;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * @author zengqingfa
 * @className MyServlet
 * @description
 * @create 2021/6/10 23:21
 */
public class MyServlet extends HttpServlet {

    //线程不安全
    Map<String, Object> map = new HashMap<>();

    //线程安全
    String s1 = "abc";
    final String s2 = "123";

    //非线程安全
    Date date1 = new Date();

    //非线程安全，引用值不变，但是值可以改变
    final Date date2 = new Date();


    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //使用上述变量

    }
}